<?php
require 'db.php';
if (!isset($_GET['id'])){
    echo "<script>alert('非法进入！')</script>";
    echo "<script>window.location.href='student.php';</script>";
    exit;
}
$id = $_GET['id'];

$sql = "delete from student where Id = ".$id; 
$query = mysqli_query($link, $sql);
if ($query){
    echo "<script>window.location.href='student.php';</script>";
    exit;
}else{
    echo "<script>alert('删除失败！')</script>";
    echo "<script>window.history.go(-1);</script>";
    exit;
}
?>